#ifndef PROXYCLASS_H
#define PROXYCLASS_H
#include <iostream>
class Food{
public:
    virtual void eat(const std::string& food) = 0;
    virtual ~Food() = default;
};

class eatFood : public Food{
public:
    void eat(const std::string& food) override{
        std::cout<<"我要吃这个"<<std::endl;
    }
};

class ProxyFood : public Food{
public:
    void eat(const std::string& food) override{
        if(chooseFood(food)){
            std::cout<<"我不吃这个"<<std::endl;
        }else{
            eatFood eatfood;
            eatfood.eat(food);
        }
    }
private:
    bool chooseFood(const std::string& food){
        if(food == "芹菜")
            return false;
        else {
            return true;
        }
    }
};

#endif // PROXYCLASS_H
